import Opt from '@/components/dt/info/Opt.js'

class Column extends Opt {

  constructor() {
    super()
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [{
      type: 'index',
      title: '序号',
      width: 50,
      fixed: 'left',
      align: 'center'
    },
    {
      field: 'userRole',
      title: '角色',
      minWidth: 100,
      align: 'center'
    },
    {
      field: 'bonusRatio',
      title: '比例',
      minWidth: 150,
      align: 'center'
    },
    {
      field: 'effectiveDate',
      title: '生效日期',
      minWidth: 90,
      align: 'center',
      slots: {
        default: (params, h) => {
          return [h('div',
            params.row.effectiveDate ? params.row.effectiveDate.split(' ')[0] : '-'
          )]
        }
      }
    }, {
      title: '操作',
      fixed: 'right',
      width: 140,
      align: 'center',
      cell: (item) => {
        let btn = []
        btn.push({
          title: '编辑',
          event: 'changeRatioLog',
        })
        return {
          btn
        }
      }
    }]
  }
}

export default Column